import 'package:flutter/material.dart';

// ignore: must_be_immutable
class MyApp2 extends StatelessWidget {
  MyApp2({super.key, this.age});
  int? age;
  final String name = '张三';
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      //设置标题栏
      appBar: AppBar(
        //设置标题文字和属性
        title: Text(
          '无状态组件',
          style: TextStyle(color: Colors.white, fontSize: 20),
        ),
        //设置标题栏背景颜色
        backgroundColor: Colors.pink,
        //设置标题居中
        centerTitle: true,
      ),
      body: Center(
        child: Text(
          '我叫$name,今年$age',
          style: TextStyle(fontSize: 20, color: Colors.red),
        ),
      ),
    );
  }
}
